package co.com.inventarios.modelo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Linea entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "LINEA", schema = "MANAGER", uniqueConstraints = {})
public class Linea implements java.io.Serializable {

	// Fields

	private String lincodigo;
	private String linnombre;
	private Long linactivo;
	private Long linultimo;
	private Timestamp linlogfec;
	private Dlluser dlluser;
	private Set<Producto> productos = new HashSet<Producto>(0);

	// Constructors

	/** default constructor */
	public Linea() {
	}

	/** minimal constructor */
	public Linea(String lincodigo) {
		this.lincodigo = lincodigo;
	}

	/** full constructor */
	public Linea(String lincodigo, String linnombre, Long linactivo,Dlluser dlluser,Timestamp linlogfec,
			Long linultimo, Set<Producto> productos) {
		this.lincodigo = lincodigo;
		this.linlogfec = linlogfec;
		this.dlluser = dlluser;
		this.linnombre = linnombre;
		this.linactivo = linactivo;
		this.linultimo = linultimo;
		this.productos = productos;
	}

	// Property accessors
	@Id
	@Column(name = "LINCODIGO", unique = true, nullable = false, insertable = true, updatable = true, length = 12)
	public String getLincodigo() {
		return this.lincodigo;
	}

	public void setLincodigo(String lincodigo) {
		this.lincodigo = lincodigo;
	}

	@Column(name = "LINNOMBRE", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public String getLinnombre() {
		return this.linnombre;
	}

	public void setLinnombre(String linnombre) {
		this.linnombre = linnombre;
	}

	@Column(name = "LINACTIVO", unique = false, nullable = true, insertable = true, updatable = true, precision = 22, scale = 0)
	public Long getLinactivo() {
		return this.linactivo;
	}

	public void setLinactivo(Long linactivo) {
		this.linactivo = linactivo;
	}

	@Column(name = "LINULTIMO", unique = false, nullable = true, insertable = true, updatable = true, precision = 22, scale = 0)
	public Long getLinultimo() {
		return this.linultimo;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "LINLOGUSER", unique = false, nullable = true, insertable = true, updatable = true)
	public Dlluser getDlluser() {
		return this.dlluser;
	}

	public void setDlluser(Dlluser dlluser) {
		this.dlluser = dlluser;
	}

	@Column(name = "LINLOGFEC", unique = false, nullable = true, insertable = true, updatable = true)
	public Timestamp getLinlogfec() {
		return this.linlogfec;
	}

	public void setLinlogfec(Timestamp linlogfec) {
		this.linlogfec = linlogfec;
	}
	
	public void setLinultimo(Long linultimo) {
		this.linultimo = linultimo;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "linea")
	public Set<Producto> getProductos() {
		return this.productos;
	}

	public void setProductos(Set<Producto> productos) {
		this.productos = productos;
	}

}